<?php

class authentication extends controller {

    public function index() {
        
    }

    public function cadastro() {
        
    }
    
   
    
    public function login() {
        $user = $this->getUser();
        $user->setEmail(trim($_POST['email']));
        $user->setPassword(trim($_POST['password']));
        $logged = $user->login();

        if ($logged)
            $this->redirect(); 
        else
            $this->redirect('/authentication/?error=true');
    }

    public function logout() {
        $this->getUser()->logout();
        $this->redirect();
    }

}

?>
